 import java.awt.Image;
import java.io.Serializable;

import javax.swing.JLabel;


public class Piece implements Serializable{

	/*****Attributs*****/
	private int m_x;
	private int m_y;
	private boolean m_white;
	private boolean m_active;
	private String m_type;
	private int nbDepl;/*stoque le nombre de déplacement de la piece*/
	
	/*****Methodes*****/

	/******** Constructeur ********/
	public Piece( int x, int y, boolean white , boolean active, int nbD)
	{
	  init( x, y, white, active, nbD);
	}
	
	public void init( int x, int y, boolean white, boolean active, int nbD)
	{
	  m_x = x;
	  m_y = y;
	  m_white = white;
	  m_active = active;
	  nbDepl = nbD;
	}
	
	/******** Get & Set ********/
	
	public int x()
	{
	  return m_x;
	}

	public int y()
	{
	  return m_y;
	}

	public boolean isWhite()
	{
	  return m_white;
	}
	
	public boolean get_active()
	{
		return m_active;
	}
	
	public void set_active(boolean active) {
		m_active = active;
	}
	
	public String getM_type() {
		return m_type;
	}

	public void setM_type(String mType) {
		m_type = mType;
	}
			
	public int getNbDepl() {
		return nbDepl;
	}

	public void setNbDepl(int nbDepl) {
		this.nbDepl = nbDepl;
	}

	/******** Fonctions utiles ********/
	
	public void move( int x, int y )
	{
	  m_x = x;
	  m_y = y;
	}

	/*Fonction qui """"supprime"""" la piece*/
	public void delete()
	{
		this.m_x = -1;
		this.m_y = -1;
		this.m_active = false;
		
	}
	
	/*Teste si un pion est en position de promotion - Méthode générique*/
	public boolean pionPromu(int y)
	{
		return false;
	}
	
	/*incrémente le nombre de déplacements*/
	public void incr_nbDepl()
	{
		System.out.println("Piece incr_nbDepl()");
		this.nbDepl++;
	}
	
	/*retourne vrai si la piece est sur l'échiquier de gauche*/
	public boolean echiquierG()
	{
		if ((nbDepl %2) == 0)
			return true;
		else return false;
	}
}
